package com.zhangxin.aiInterview.service.impl;

import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhangxin.aiInterview.mapper.TechFieldMapper;
import com.zhangxin.aiInterview.model.entity.TechField;
import com.zhangxin.aiInterview.model.vo.TechFieldVO;
import com.zhangxin.aiInterview.service.TechFieldService;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

/**
* @author ZX
* @description 针对表【tech_field(技术领域表)】的数据库操作Service实现
* @createDate 2025-04-28 16:17:35
*/
@Service
public class TechFieldServiceImpl extends ServiceImpl<TechFieldMapper, TechField>
    implements TechFieldService{


    @Override
    public TechFieldVO getTechFieldVO(TechField techField) {
        if (techField == null) {
            return null;
        }
        TechFieldVO techFieldVO = new TechFieldVO();
        BeanUtils.copyProperties(techField, techFieldVO);
        return techFieldVO;
    }

    @Override
    public List<TechFieldVO> getTechFieldVO(List<TechField> techFieldList) {
        if (CollUtil.isEmpty(techFieldList)) {
            return new ArrayList<>();
        }
        return techFieldList.stream().map(this::getTechFieldVO).collect(Collectors.toList());
    }
}